/**
 * 
 */
package com.calendar.guos.client.data;

import java.util.HashMap;
import java.util.LinkedList;

import com.google.gwt.gdata.client.calendar.CalendarEntry;
import com.google.gwt.gdata.client.calendar.CalendarEventEntry;

/**
 * @author Amara Daal
 *
 */
public class LocalDataStore {
	  //All of User's calendars
	  public LinkedList<CalendarEntry> usersCalendarsList = new LinkedList<CalendarEntry>();
	  
	  //Index of each calendar maps to [calendarNum][calendarEventNum]
	  public HashMap<String, CalendarEventEntry[]> usersEventsMap = new HashMap<String, CalendarEventEntry[]>();

	/**
	 * 
	 */
	public LocalDataStore() {
		// TODO Auto-generated constructor stub
	}
	  /**
	   * Add calendar gotten from google to our local buffer/store
	   * @param calendar the calendar we recieved from google
	   * @param events the events associated with tthis calendar
	   */
	  public void addCalendarEventsToStore(CalendarEntry calendar, CalendarEventEntry[] events){
		  usersCalendarsList.addLast(calendar);
		  usersEventsMap.put(calendar.getTitle().getText(), events);
		  
		  usersCalendarsList.addLast(calendar);
	  }
	  
	  /**
	   * Clear our local buffer of calendars and their respective events
	   * in order to add the all new calendar list/events we just got from google
	   */
	  public void disposeEverythingInStore(){
		  usersCalendarsList = new LinkedList<CalendarEntry>();
		  usersEventsMap = new HashMap<String, CalendarEventEntry[]>();
	  }

}
